MESSAGE(STATUS "Looking for daemon")
FIND_PATH(DAEMON_INCLUDE_PATH 
	NAMES
		daemon.h
	PATHS
		/usr/include
		/usr/include/libdaemon
		/usr/local/include
		/usr/local/include/libdaemon
		/sw/include
		/opt/local/include
		NO_DEFAULT_PATH)

FIND_LIBRARY(DAEMON_LIBRARY_PATH
	NAMES
		daemon
	PATHS
		/usr/lib64
		/usr/lib
		/usr/local/lib64
		/usr/local/lib
		/sw/lib
		/opt/local/lib
		NO_DEFAULT_PATH)

IF(DAEMON_INCLUDE_PATH)
	SET(DAEMON_FOUND 1 CACHE STRING "Set to 1 if daemon is found, 0 otherwise")
	MESSAGE(STATUS "Looking for libdl headers - found")
ELSE(DAEMON_INCLUDE_PATH)
	SET(DAEMON_FOUND 0 CACHE STRING "Set to 1 if daemon is found, 0 otherwise")
	MESSAGE(FATAL_ERROR "Looking for libdaemon headers - not found")
ENDIF(DAEMON_INCLUDE_PATH)

IF(DAEMON_LIBRARY_PATH)
	SET(DAEMON_FOUND 1 CACHE STRING "Set to 1 if daemon is found, 0 otherwise")
	MESSAGE(STATUS "Looking for libdaemon library - found")
ELSE(DAEMON_LIBRARY_PATH)
	SET(DAEMON_FOUND 0 CACHE STRING "Set to 1 if daemon is found, 0 otherwise")
	MESSAGE(FATAL_ERROR "Looking for libdaemon library - not found")
ENDIF(DAEMON_LIBRARY_PATH)

MARK_AS_ADVANCED(DAEMON_FOUND)
